#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll gcd(ll a, ll b) { return ((b == 0) ? a : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return (b / gcd(a, b)) * a; }
void Candidate_Elde7k() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
}
bool validDay(string x, int month) {
if (x.size() != 2) return false;
int day = stoi(x);
if (month == 1 || month == 3 || month == 5 || month == 7 ||
month == 8 || month == 10 || month == 12) return (day >= 1 && day <= 31);
else if (month == 2) return (day >= 1 && day <= 28);
else return (day >= 1 && day <= 30);
}
bool validMonth(string x) {
if (x.size() != 2) return false;
int y = stoi(x);
return (y >= 1 && y <= 12);
}
bool validYear(string x) {
if (x.size() != 4) return false;
int y = stoi(x);
return (y >= 2013 && y <= 2015);
}
int main() {
Candidate_Elde7k();
string s; cin >> s;
int n = s.size();
map<string, int>save;
for (int i = 0; i + 9 < n; i++) {
if (s[i] != '-') {
bool flag = true;
string day = "";
string month = "";
string year = "";
int j = i;
while (j < i + 2) {
flag &= (s[j] != '-');
day += s[j++];
}
flag &= (s[j] == '-');
j++;
while (j < i + 5) {
flag &= (s[j] != '-');
month += s[j++];
}
flag &= (s[j] == '-');
j++;
while (j < i + 10) {
flag &= (s[j] != '-');
year += s[j++];
}
if (flag) {
if (validMonth(month) && validYear(year) && validDay(day, stoi(month))) {
string t = day + "-" + month + "-" + year;
save[t]++;
}
}
}
}
string ans = "";
int mx = 0;
for (auto& it : save) {
if (it.second > mx) {
mx = it.second;
ans = it.first;
}
}
cout << ans << "\n";
}
275. H-Index II | 274. H-Index |
260. Single Number III | 240. Search a 2D Matrix II |
238. Product of Array Except Self | 229. Majority Element II |
222. Count Complete Tree Nodes | 215. Kth Largest Element in an Array |
198. House Robber | 153. Find Minimum in Rotated Sorted Array |
150. Evaluate Reverse Polish Notation | 144. Binary Tree Preorder Traversal |
137. Single Number II | 130. Surrounded Regions |
129. Sum Root to Leaf Numbers | 120. Triangle |
102. Binary Tree Level Order Traversal | 96. Unique Binary Search Trees |
75. Sort Colors | 74. Search a 2D Matrix |
71. Simplify Path | 62. Unique Paths |
50. Pow(x, n) | 43. Multiply Strings |
34. Find First and Last Position of Element in Sorted Array | 33. Search in Rotated Sorted Array |
17. Letter Combinations of a Phone Number | 5. Longest Palindromic Substring |
3. Longest Substring Without Repeating Characters | 1312. Minimum Insertion Steps to Make a String Palindrome |